import axios from 'axios';
import * as constants from './constants';

const changeDetail = (data) => ({
  type: constants.GET_HOMEWORKDATA,
  workShowList: data
});

// 获取homeworkshow数据 workShowList
export const getHomeWorkData = () => {
  return (dispatch) => {
    axios.get('http://localhost:9080/home/web?start=0&length=4').then((res) => {
      // console.log(res.data.data);
      dispatch(changeDetail(res.data.data));
    }).catch(() => {
      console.log('获取workShowList出错！');
    })
  }
};
